package com.czl.module_storehouse.utils;

import com.czl.module_service.system.Constants;

/**
 * @author by xubin,
 * @date on 2022/2/24.
 * PS: Not easy to write code, please indicate.
 */
public class QrCodeRuleUtils {

    public static String handleStorehouseProductResult(String content) {
        if (content == null || content.isEmpty()) {
            return content;
        }

        int length = Constants.QRCodeRule.REMAP_SH.length();
        if (!content.contains(Constants.QRCodeRule.REMAP_SH)) {
            return content;
        }
        if (content.length() < length) {
            return content;
        }
        return content.substring(length);
    }

    public static String handleResult(String content, String rule) {
        if (rule == null || rule.isEmpty() || content == null || content.isEmpty()) {
            return content;
        }
        if (!content.contains(rule)) {
            return null;
        }
        int length = rule.length();
        if (content.length() < length) {
            return content;
        }
        return content.substring(length);
    }
}
